#!/bin/bash

# GitBuild 开发模式启动脚本
# 使用 nodemon 和 vite 的热重载功能

echo "========================================"
echo "  GitBuild 开发模式启动"
echo "========================================"

# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# 检查 concurrently 是否安装
if ! npm list concurrently > /dev/null 2>&1; then
    echo -e "${YELLOW}安装 concurrently...${NC}"
    npm install --save-dev concurrently
fi

echo -e "${GREEN}启动开发服务器（支持热重载）...${NC}"
echo ""
echo "后端服务: http://localhost:3000 (nodemon)"
echo "前端服务: http://localhost:5173 (vite)"
echo ""
echo -e "${YELLOW}按 Ctrl+C 停止所有服务${NC}"
echo ""

# 使用 concurrently 同时运行后端和前端
npm run dev:all
